import { getList } from "../../request/index";
import { useEffect, useState } from "react";
import { Button } from "antd-mobile";
import MyNavbar from "../../Share/MyNavbar";
import { useNavigate } from "react-router-dom";
import "./list.css";
function List() {
  const navigate = useNavigate();
  const [listsj, setListsj] = useState<any[]>([]);
  useEffect(() => {
    getList().then((res) => {
      console.log(res);
      setListsj(res.data.data);
    });
  }, []);
  const tzxq = (id: number) => {
    navigate("/xq/" + id);
  };
  return (
    <div className="list-box">
      <MyNavbar title="更多" />
      {listsj.map((item) => {
        return (
          <>
            {/* <div className="list-item" onClick={tzxq(item.id)}> */}
            <div className="list-item" onClick={()=>tzxq(item.id)}>
              <img className="list-img" src={item.imgPath} alt="" />
              <div className="list-item2">
                <h4>{item.showName}</h4>
                <div className="list-item21">
                  <p>{item.showCity}</p>
                  <Button>免费</Button>
                </div>
              </div>
            </div>
          </>
        );
      })}
    </div>
  );
}

export default List;
